package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderGoodsMapper;
import com.ruoyi.system.domain.OrderGoods;
import com.ruoyi.system.service.IOrderGoodsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 订单商品关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-22
 */
@Service
public class OrderGoodsServiceImpl implements IOrderGoodsService 
{
    @Autowired
    private OrderGoodsMapper orderGoodsMapper;

    /**
     * 查询订单商品关联
     * 
     * @param id 订单商品关联主键
     * @return 订单商品关联
     */
    @Override
    public OrderGoods selectOrderGoodsById(String id)
    {
        return orderGoodsMapper.selectOrderGoodsById(id);
    }

    /**
     * 查询订单商品关联列表
     * 
     * @param orderGoods 订单商品关联
     * @return 订单商品关联
     */
    @Override
    public List<OrderGoods> selectOrderGoodsList(OrderGoods orderGoods)
    {
        return orderGoodsMapper.selectOrderGoodsList(orderGoods);
    }

    /**
     * 新增订单商品关联
     * 
     * @param orderGoods 订单商品关联
     * @return 结果
     */
    @Override
    public int insertOrderGoods(OrderGoods orderGoods)
    {
        orderGoods.setCreateTime(DateUtils.getNowDate());
        return orderGoodsMapper.insertOrderGoods(orderGoods);
    }

    /**
     * 修改订单商品关联
     * 
     * @param orderGoods 订单商品关联
     * @return 结果
     */
    @Override
    public int updateOrderGoods(OrderGoods orderGoods)
    {
        orderGoods.setUpdateTime(DateUtils.getNowDate());
        return orderGoodsMapper.updateOrderGoods(orderGoods);
    }

    /**
     * 批量删除订单商品关联
     * 
     * @param ids 需要删除的订单商品关联主键
     * @return 结果
     */
    @Override
    public int deleteOrderGoodsByIds(String ids)
    {
        return orderGoodsMapper.deleteOrderGoodsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除订单商品关联信息
     * 
     * @param id 订单商品关联主键
     * @return 结果
     */
    @Override
    public int deleteOrderGoodsById(String id)
    {
        return orderGoodsMapper.deleteOrderGoodsById(id);
    }
}
